<template>
  <drop-wrap :data="data" :index="index" :element="element">
    <el-form-item
      :class="element.className"
      :id="element.cid"
      :label="element.options.label"
    >
      <el-radio-group
        size="small"
        v-model="element.options.defaultValue"
        @change="change"
        v-bind="Attrs"
      >
        <template v-if="element.className == 'radio-genre-1'">
          <el-radio-button
            :label="item.value"
            v-for="(item, index) in element.options.options"
            :key="index"
            >{{ item.label }}</el-radio-button
          >
        </template>
        <template v-else>
          <el-radio
            :label="item.value"
            v-for="(item, index) in element.options.options"
            :key="index"
            >{{ item.label }}</el-radio
          >
        </template>
      </el-radio-group>
    </el-form-item>
  </drop-wrap>
</template>

<script>
export default {
  props: ["element", "data", "index"],
  data() {
    return {};
  },
  computed: {
    prop() {
      return `${this.element.fullModelTag}`;
    },
    store() {
      return this.element.getRoot();
    },
    Attrs() {
      const attrsConfig = {
        disabled: this.element.options.disabled,
      };
      return Object.assign({}, attrsConfig);
    },
  },
  methods: {
    change() {
      this.element.options.eventCode &&
        this.store.eventCenter.fire(this.element.options.eventCode, {
          triggerSource: this.element,
        });
    },
  },
};
</script>

<style  scoped>
</style>